public class LambdaTest1 {
    public static void main(String[] args) {
        // 认识Lambda表达式
//        Animal a = new Animal(){
//            @Override
//            public void run() {
//                System.out.println("跑");
//            }
//        };
//        a.run();


        // 注意Lambda表达式并不是能简化全部匿名内部类的写法,只能简化函数式接口的匿名内部类
//        Animal a = () -> {
//            System.out.println("跑");
//        };
//        a.run();


//            Swimming swimming = new Swimming(){
//                @Override
//                public void swim() {
//                    System.out.println("游泳");
//
//                }
//            };
//            swimming.swim();

            Swimming swimming = () -> {
                System.out.println("游泳");
            };
            swimming.swim();
    }
}

interface Swimming{
    void swim();
}


abstract class Animal{
    public abstract void run();
}